<?php
// +----------------------------------------------------------------------
// | WoShiMaiJia Projcet 
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://www.woshimaijia.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: xinqiyang <517577550@qq.com>
// +----------------------------------------------------------------------
class DistrictModel extends MetaModel
{

	/**
	 * 获取省市区
	 * TODO:现在先用文件缓存,部署memcache后用 内存缓存就好了
	 */
	public function getDistrict()
	{
		//$this->cache->rm('district');
		//获得数据
		if(!$this->cache->get('district'))
		{
		    //写入cache,5000多条的时候就挂掉了
		    $this->cache->set('district',$this->where('level=2 or id in (1,2,9,22)')->select(),0,-1);
		    //dump('setok');
		}
		return $this->cache->get('district');

		//
//		$city = F('city');
//		if($city)
//		{
//			return $city;
//		}
//		$city = $this->where('level=2 or id in (1,2,9,22)')->select();
//		F('city',$city); 
//		return $city;
	}
	
	
	
	
} 
?>